Crate cmn

source ·
Expand description

A Rust library for accessing a collection of mathematical and cryptographic constants

Rust

Rust Crates.io Lib.rs GitHub License

Overview

Common (CMN), a Rust library designed for developers who are looking for a comprehensive collection of mathematical and cryptographic constants.

CMN is a modern, fast, and user-friendly library that makes it easy to access a wide range of mathematical and cryptographic constants, including the mathematical constant “Euler”, the hash algorithm used, the cost of the hash algorithm, the length of the hash, the mathematical constant “Phi”, the mathematical constant “Pi”, the Planck constant, a set of special characters, and much more.

Features

The following table lists the Constants available in the Common library.

| Constants | Description | | — | — | | EULER | Euler’s constant is a mathematical constant approximately equal to 2.71828. | | HASH_ALGORITHM | The hash algorithm used to generate the hash. The default is Blake3. | | HASH_COST | The cost of the hash. | | HASH_LENGTH | The length of the hash. | | PHI | The golden ratio is a number approximately equal to 1.618033988749895. | | PI | Pi is the ratio of a circle’s circumference to its diameter. | | PLANCK | Planck’s constant is a physical constant that is approximately equal to 6.62607015 × 10−34 joule seconds. | | SQRT5 | The square root of 5 is a number approximately equal to 2.23606797749979. | | SPECIAL_CHARS | A list of special characters. |

The following table lists the dictionaries available in the Common library.

| Words | Description | | — | — | | words | Contains a dictionary of common words. |

Usage

Common can be any serde::Serialize or serde::Deserialize types

Examples


// Import the Common libraries
use self::common::Constants;
use self::common::Words;

// Constants
let constants = Constants.constants();
for constant in constants {
    println!("Name: {} Value: {}", constant.name, constant.value);
}

// Words
let words = Words::new();
let words_list = words.words_list();
assert_eq!(words_list[0], "aboard");

Re-exports

pub use constants::Constants;
pub use words::Words;

Modules

The constants module contains the Constants structure, which provides a collection of constant values that are used throughout the library.
The words module contains the Words structure, which provides a collection of words that are used throughout the library.

Structs

The Common structure provides a central location to store data that is commonly used throughout the library. The structure implements the Serialize and Deserialize traits from the serde crate to enable serialization and deserialization of the data.

Traits

A data structure that can be deserialized from any data format supported by Serde.
A data structure that can be serialized into any data format supported by Serde.

Derive Macros